package com.nn.gui;

import java.awt.Color;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Seeker {

    private int x;
    private int y;
    private float ax;
    private float ay;
    private final List<N> connected = new ArrayList<N>();
    private final Set<Long> addedCell = new HashSet<Long>();
    private final Color color = new Color((int) (Math.random() * 150), (int) (Math.random() * 150), (int) (Math.random() * 150), 200);
    private final int deltaX = (int) (Math.random() * 4) - 2;
    private final int deltaY = (int) (Math.random() * 4) - 2;
    private int priority;
    private float activation;

    public float getActivation() {
        return activation;
    }

    public void setActivation(float activation) {
        this.activation = activation;
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }

    public Color getColor() {
        return color;
    }

    public int getDeltaX() {
        return deltaX;
    }

    public int getDeltaY() {
        return deltaY;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public float getAx() {
        return ax;
    }

    public void setAx(float ax) {
        this.ax = ax;
    }

    public float getAy() {
        return ay;
    }

    public void setAy(float ay) {
        this.ay = ay;
    }

    public List<N> getConnected() {
        return connected;
    }

    private long getPointHashCode(N p) {
        int hash = 5;
        hash = 31 * hash + p.getX();
        hash = 31 * hash + p.getY();
        return hash;
    }

    public boolean isPointAdded(N p) {
        long hash = getPointHashCode(p);
        return addedCell.contains(hash);
    }

    public void addConnectedPoint(N p) {
        long hash = getPointHashCode(p);
        addedCell.add(hash);
        connected.add(p);
    }
}
